Skip to content

20261110-linuxkm-stdrng-purge-etc - #12107

Open
douzzer wants to merge 6 commits into
wolfSSL:masterfrom
douzzer:20261110-linuxkm-stdrng-purge-etc
Open

douzzer wants to merge 6 commits into
wolfSSL:masterfrom
douzzer:20261110-linuxkm-stdrng-purge-etc

Conversation

@douzzer

@douzzer douzzer commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

linuxkm/linuxkm_wc_port.h linuxkm/lkcapi_sha_glue.c linuxkm/simd_hammer/simd_hammer.c .wolfssl_known_macro_extras: fixes for removal of stdrng alg from the LKCAPI.

  • gate crypto/internal/rng.h inclusion and "stdrng" alg registration on kernel
    <7.5 (<linux-next of 20261110).

  • add WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG with override
    WOLFSSL_LINUXKM_LKCAPI_NO_STDRNG.

  • add dummy macro variant of wc_linux_kernel_rng_is_wolfcrypt().

  • add gating on WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG as needed throughout
    linuxkm/lkcapi_sha_glue.c.

  • add a HAVE_STDRNG indicator macro to linuxkm/simd_hammer/simd_hammer.c and
    gate the "rng" probe on it. also add a runtime report of the instantiated RNG
    driver name, and a warning if it isn't wolfCrypt.

  • note, on !WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG builds, there’s no longer a
    deinstall_algs prerequisite before rmmod.

wolfcrypt/src/asn.c wolfcrypt/src/asn_orig.c wolfcrypt/src/signature.c wolfcrypt/test/test.c doc/dox_comments/header_files/asn_public.h:

bound the digSz in wc_EncodeSignature(), and catch zero (error) return from it
in wc_SignatureDerEncode(). Add test coverage to rsa_sig_test().

linuxkm/lkcapi_rsa_glue.c: add digest length checks to the pkcs1 sign callbacks,
matching those in the verify callbacks since ff93e6d and 8fef82c, by
factoring the common argument validation into km_pkcs1_check_digest_len().

tests/api/test_tls.c: skip test_tls_unset_fd_no_stdin_io() if defined(HAVE_VALGRIND).

tested with

wolfssl-multi-test.sh ...
check-source-text
defaults-gcc-latest-valgrind
'.*linuxkm-next.*'
linuxkm-fips-dev-insmod-cust-kernel-1
linuxkm-fips-dev-insmod-wolfguard-cust-kernel-3 linuxkm-fips-dev-insmod-cust-kernel-1
linuxkm-fips-v5-vanilla-insmod-wolfguard-cust-kernel-6
linuxkm-fips-v5-strict-dist-insmod-cust-kernel-2-amdrdseed
linuxkm-6.15-all-cryptonly-quantum-safe-allintelasm-LKCAPI-insmod-crypto-fuzzer-kmemleak-no-stdrng
linuxkm-6.15-all-cryptonly-quantum-safe-noasm-LKCAPI-insmod-crypto-fuzzer-ksan-no-stdrng

…er/simd_hammer.c .wolfssl_known_macro_extras: fixes for removal of stdrng alg from the LKCAPI.

* gate crypto/internal/rng.h inclusion and "stdrng" alg registration on kernel
  <7.5 (<linux-next of 20261110).

* add WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG with override
  WOLFSSL_LINUXKM_LKCAPI_NO_STDRNG.

* add dummy macro variant of wc_linux_kernel_rng_is_wolfcrypt().

* add gating on WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG as needed throughout
  linuxkm/lkcapi_sha_glue.c.

* add a HAVE_STDRNG indicator macro to linuxkm/simd_hammer/simd_hammer.c and
  gate the "rng" probe on it.  also add a runtime report of the instantiated RNG
  driver name, and a warning if it isn't wolfCrypt.

* note, on !WOLFSSL_LINUXKM_LKCAPI_HAVE_STDRNG builds, there’s no longer a
  deinstall_algs prerequisite before rmmod.
…c wolfcrypt/test/test.c doc/dox_comments/header_files/asn_public.h:

bound the digSz in wc_EncodeSignature(), and catch zero (error) return from it
in wc_SignatureDerEncode().  Add test coverage to rsa_sig_test().
… callbacks,

matching those in the verify callbacks since ff93e6d and 8fef82c, by
factoring the common argument validation into km_pkcs1_check_digest_len().
Copilot AI balanced review requested due to automatic review settings November 12, 2026 03:31
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active issues include a compilation failure in the kprobe configuration without stdrng, phantom registration accounting that blocks deinstallation, and a header guard that prevents wolfCrypt RNG recognition.

3 open issues
What changed in this PR

This PR updates wolfSSL’s Linux kernel integration for removal of stdrng and strengthens RSA digest-length validation.

Changes:

  • Gate stdrng registration and probes by kernel support, with an explicit disable override.
  • Bound signature digest encoding, share RSA callback validation, and add regression tests.
  • Document encoding limits and skip the unset-file-descriptor TLS test under Valgrind.
File Description
wolfcrypt/​test/​test.c Test oversized digest rejection for in-place and separate-buffer encoding.
wolfcrypt/​src/​signature.c Handle signature-encoding failure.
wolfcrypt/​src/​asn.c Bound digest size in template-based encoding.
wolfcrypt/​src/​asn_orig.c Bound digest size in legacy encoding.
tests/​api/​test_tls.c Skip the unset-descriptor test under Valgrind.
linuxkm/​simd_hammer/​simd_hammer.c Gate RNG probes and report the selected driver.
linuxkm/​lkcapi_sha_glue.c Adapt RNG registration and cleanup for builds without stdrng.
linuxkm/​lkcapi_rsa_glue.c Share digest validation, advertise digest sizes, and extend tests.
linuxkm/​linuxkm_wc_port.h Add stdrng feature gating and a fallback RNG detector macro.
doc/​dox_comments/​header_files/​asn_public.h Document digest-size limits and error returns.
.wolfssl_known_macro_extras Register the new stdrng disable macro.

Review effort: Balanced

Comment thread linuxkm/lkcapi_sha_glue.c Resolved
Comment thread linuxkm/lkcapi_sha_glue.c Resolved
Comment thread linuxkm/linuxkm_wc_port.h Resolved

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12107

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Not reviewed (no scan target covers them): .wolfssl_known_macro_extras, doc/dox_comments/header_files/asn_public.h
Coverage: 9 of 9 in-scope changed file(s) opened by the reviewer

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Max

linuxkm/linuxkm_wc_port.h and linuxkm/lkcapi_sha_glue.c: fix scoping of wc_linux_kernel_rng_is_wolfcrypt();

linuxkm/lkcapi_sha_glue.c: fix dummy call to wc_linuxkm_drbg_startup() to leave wc_linuxkm_drbg_loaded defined;

wolfcrypt/src/asn_orig.c: check digSz against actual size of digArray.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12107

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs
Unchanged since last review (not re-run): wolfssl-bugs
Not reviewed (no scan target covers them): .wolfssl_known_macro_extras, doc/dox_comments/header_files/asn_public.h
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/asn_orig.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review November 12, 2026 04:47

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The unload notice is hidden for no-STDRNG builds with random-bytes callbacks, although those builds still require deinstall_algs to release the module reference and allow rmmod; the PR description also needs qualification.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Keep the unload notice for callback-backed no-STDRNG builds

linuxkm/​lkcapi_sha_glue.c:5828

With WOLFSSL_LINUXKM_LKCAPI_NO_STDRNG and random-bytes callbacks enabled, rmmod still fails because the supplied kernel patches retain a module reference until the callbacks are unregistered. This guard hides the deinstall_algs instruction needed to release that reference. Retain the unload notice for callback-backed builds too, and qualify the PR description's claim that no-STDRNG builds no longer require this step.

3 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants